﻿using UnityEngine;

[CreateAssetMenu(fileName = "ColorArray", menuName = "Common/ColorArray", order = 0)]
public class ColorArray : ScriptableObject
{
    public Color[] colors;

    [EditorButton]
    public void GenerateColorCode()
    {
        //todo 
        string code = "";
        code = " public static Color[] TeamColors = new Color[]{";
        code += "\n";
        for (int i = 0; i < colors.Length; i++)
        {
            var color = colors[i];
            code += $"new Color({color.r},{color.g},{color.b},{color.a}),\n";
        }

        code += "\n};";

        UnityEngine.GUIUtility.systemCopyBuffer = "code";
        Debug.Log("复制代码成功");

    }
}